import { defineStore } from "pinia";
import type { RouteRecordRaw } from "vue-router";
import { pinia } from "../index";

export const useMenuStore = defineStore("menu", () => {
  const routers = ref<RouteRecordRaw[]>([]);
  const dynamicRoutes = ref<RouteRecordRaw[]>([]);

  const setRouter = (router: RouteRecordRaw[]) => {
    routers.value = router;
  };

  return { routers, dynamicRoutes, setRouter };
});
// setup 外使用
export function useMenuHook() {
  return useMenuStore(pinia);
}
